package com.example.harmonyrouter;

import com.example.harmonyrouter.slice.MainAbilitySlice;
import com.example.router.annotation.Router;
import com.example.routercore.HRouter;
import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Component;

@Router(path = "/main/MainAbility")
public class MainAbility extends Ability {
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
//        super.setMainRoute(MainAbilitySlice.class.getName());

        setUIContent(ResourceTable.Layout_ability_main);

        findComponentById(ResourceTable.Id_text_helloworld).setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
//                HRouter.getInstance().build("/module1/ModuleAbility1").navigation(MainAbility.this);
                HRouter.getInstance().build("/module1/ModuleAbility1Slice").navigation(MainAbility.this);
            }
        });
    }
}
